#include <iostream>
#define N 100

using namespace std;

void readintVector(int array[], int elements){
for (int i=0; i<elements; i++){
	cout<<"a["<<i<<"]=";
	cin>>array[i];
	cout<<"\n";}
}
float average(int array[], int elements, int himself){
	float sum=0;
	for (int i=0; i<elements; i++){
		if(array[i]!=himself){
			sum += array[i];}
}
return sum/(elements-1);
}
void printfloatVector(float av[], int elements){
for (int i=0; i<elements; i++){
	cout<<av[i]<<" ";}
	cout<<"\n";
}

void average_array(int array[],int elements, float av[]){
for (int i=0; i<elements; i++)
	av[i]=average(array, elements, array[i]);
}
 
int main(){
int array[N];
float av[N];
int elements;
cout<<"Type the number of elements you want in the array: ";
cin>>elements;
readintVector(array, elements);

cout<<"The original array is ";
for(int i=0; i<elements; i++){
	cout<<array[i]<<" ";}
cout<<endl;
average_array(array, elements, av);
cout<<"The array with the average of the elements is: ";
printfloatVector(av, elements);
return 0;
}


